<?php
/*
*对游记表的操作

*/
class blogModel{
    public function getInfo($status){
        //选择所有游记
       // echo $status;
        $sql="select * from uu_blog where status='$status' group by id desc";
        //$sql="insert into uu_blog(fid,topic,playtime)"
        //$sql="select * from uu_blog";
        $result=$GLOBALS['ydle']->query($sql);
     //取出游记的具体内容
     while($row=$GLOBALS['ydle']->fetch_assoc($result)){
        $lists[]=$row;
     }
     //print_r($lists);
     return $lists;
    }
    //删除全部或将全部标记为已读，取消发布,其他游记为发布
    public function setState($status,$data_state,$li_id){
        for($i=0;i<count($li_id);$i++){
        if($data_state==1){
            if($status==2){//将已选的已发布的全部改为取消发布
            $sql="update uu_blog set status=3 where id={$li_id[$i]} limit 1";
            $result=$GLOBALS['ydle']->query($sql);
            }else if($status==1){//将已选的收到的全部改为通过审核
                $sql="update uu_blog set status=2 where id={$li_id[$i]} limit 1";
                $result=$GLOBALS['ydle']->query($sql);
            }else{//将已选的其他游记改为发布
                $sql="update uu_blog set status=2 where id={$li_id[$i]} limit 1";
                $result=$GLOBALS['ydle']->query($sql);
            }
        }else if($data_state==2){
            $sql="update uu_blog set status=4 where id={$li_id[$i]} limit 1";
            $result=$GLOBALS['ydle']->query($sql);
        }
        }
        /*if($result)
        return true;
        else
        return false;*/
    }
	public function blogInfo($id){
        $id=$id+0;
		$sql="select * from uu_blog where id=$id";
		$result=$GLOBALS['ydle']->query($sql);
		while($row=$GLOBALS['ydle']->fetch_assoc($result)){
        $lists[]=$row;
     }
     // echo $fid=$lists[0]['fid'];
     // echo $sql2="select dname from pft_member where id=$fid";
     // $result2=$GLOBALS['le']->query($sql2);
     // while($row2=$GLOBALS['le']->fetch_assoc($result2)){
         // $lists2[]=$row2;
         // }
		return $lists;
	}
    public function personInfo($fid){
        $id=$id+0;
        $sql="select * from pft_member where id=$fid";
		$result=$GLOBALS['le']->query($sql);
		while($row=$GLOBALS['le']->fetch_assoc($result)){
        $lists[]=$row;
     }
     // print_r($lists);
     return $lists;
    }
}

?>